﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DataAccess;

namespace QUANLYKHACHSAN_N4
{
    public partial class frmThemSuaPhong : DevComponents.DotNetBar.Office2007Form
    {
        public frmThemSuaPhong()
        {
            InitializeComponent();
            cbLoaiPhong.DataSource = LoaiPhong_Info.GetAll().Tables[0];
            cbLoaiPhong.DisplayMember = cbLoaiPhong.ValueMember = "tenloaiphong";
           
        }
        public string ten = ""; 
        public bool status = false;
        private void btnOK_Click(object sender, EventArgs e)
        {
            try
            {
                if (ten == "") 
                {
                    if (Phong_Info.Add(txtTenPhong.Text, cbLoaiPhong.Text, false, false))
                    {
                        status = true;
                        Close();
                    }
                    return;
                }

                if (Phong_Info.Update(ten, txtTenPhong.Text, cbLoaiPhong.Text))
                {
                    status = true;
                    Close();
                }
                return;
            }
            catch
            {
                BatLoi.ThongBao("nhap sai du lieu vui long kiem tra");
            }
            
        }

    }
}
